//
//  MusicView.m
//  product_B
//
//  Created by zyc on 16/6/1.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "MusicView.h"

@implementation MusicView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/


- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        _picture = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 60, 60)];
        _picture.layer.cornerRadius = 30;
        _picture.layer.masksToBounds = YES;
        [self addSubview:_picture];
        
        _title = [[UILabel alloc]initWithFrame:CGRectMake(10, 70, 200, 30)];
        [self addSubview:_title];
        
        _author = [[UILabel alloc]initWithFrame:CGRectMake(80, 30, 150, 30)];
        [self addSubview:_author];
        
        _button = [UIButton buttonWithType:UIButtonTypeSystem];
        _button.frame = CGRectMake(kWidth - 100, 25, 50, 50);
        [_button setBackgroundImage:[UIImage imageNamed:@"暂停"] forState:UIControlStateNormal];
        [self addSubview:_button];
    }
    
    return self;
}

- (void)setMusicViewWithModel:(MusicPlayerModel *)model{
    [_picture sd_setImageWithURL:[NSURL URLWithString:model.picture]];
    _author.text = model.author;
    _title.text = model.title;
}


@end
